package com.fanchuan.uzx.ui.tab;

import com.fanchuan.uzx.list.lecture.LectureFragment_;
import com.fanchuan.uzx.list.news.NewsFragment_;
import com.fanchuan.uzx.list.offer.OfferFragment_;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class MainPageAdapter extends FragmentStatePagerAdapter {
	int count = 0;
	Context mContext;
	public MainPageAdapter(FragmentManager fm, int length, Context context) {
		super(fm);
		count = length;
		mContext = context;
	}

	@Override
	public Fragment getItem(int position) {
		Fragment fragment = null;
		if(position == 0){
			fragment = NewsFragment_.instantiate(mContext, NewsFragment_.class.getName());
//			fragment = CountingFragment_.instantiate(mContext, CountingFragment_.class.getName());
		}else if(position == 1){
			fragment = OfferFragment_.instantiate(mContext, OfferFragment_.class.getName());
		}else if(position == 2){
			fragment = LectureFragment_.instantiate(mContext, LectureFragment_.class.getName());
		}
		
		return fragment;
	}

//	@Override
//	public void destroyItem(ViewGroup container, int position, Object object) {
//
//	}
	
	@Override
	public int getCount() {
		return count;
	}

}
